package com.github.catvod.spider.merge;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class oe {
  public static Object[] V0(String paramString) {
    try {
      LinkedHashMap<Object, Object> linkedHashMap = new LinkedHashMap<Object, Object>();
      this();
      return new Object[] { Integer.valueOf(200), "text/plain; charset=utf-8", byteArrayInputStream };
    } finally {
      paramString = null;
      paramString.printStackTrace();
    } 
  }
  
  public static String h(LinkedHashMap<String, LinkedHashMap<String, ArrayList<String>>> paramLinkedHashMap) {
    JSONArray jSONArray = new JSONArray();
    Iterator<String> iterator = paramLinkedHashMap.keySet().iterator();
    label33: while (true) {
      if (iterator.hasNext()) {
        String str = iterator.next();
        JSONArray jSONArray1 = new JSONArray();
        LinkedHashMap linkedHashMap = paramLinkedHashMap.get(str);
        if (linkedHashMap.isEmpty())
          continue; 
        Iterator<String> iterator1 = linkedHashMap.keySet().iterator();
        while (true) {
          if (iterator1.hasNext()) {
            String str1 = iterator1.next();
            ArrayList arrayList = (ArrayList)linkedHashMap.get(str1);
            if (arrayList.isEmpty())
              continue; 
            JSONArray jSONArray2 = new JSONArray();
            for (byte b = 0; b < arrayList.size(); b++)
              jSONArray2.put(arrayList.get(b)); 
            JSONObject jSONObject1 = new JSONObject();
            try {
              jSONObject1.put("name", str1);
              jSONObject1.put("urls", jSONArray2);
            } catch (JSONException jSONException) {}
            jSONArray1.put(jSONObject1);
            continue;
          } 
          JSONObject jSONObject = new JSONObject();
          try {
            jSONObject.put("group", str);
            jSONObject.put("channels", jSONArray1);
            jSONArray.put(jSONObject);
          } catch (JSONException jSONException) {
            jSONArray.put(jSONObject);
          } 
          continue label33;
        } 
        break;
      } 
      return jSONArray.toString();
    } 
  }
  
  public static void j(LinkedHashMap<String, LinkedHashMap<String, ArrayList<String>>> paramLinkedHashMap, String paramString) {
    try {
      BufferedReader bufferedReader = new BufferedReader();
      StringReader stringReader = new StringReader();
      this(paramString);
      this(stringReader);
      paramString = bufferedReader.readLine();
      LinkedHashMap<Object, Object> linkedHashMap2 = new LinkedHashMap<Object, Object>();
      this();
      LinkedHashMap<Object, Object> linkedHashMap1 = linkedHashMap2;
      while (paramString != null) {
        ArrayList<String> arrayList1;
        String str2;
        if (paramString.trim().isEmpty()) {
          paramString = bufferedReader.readLine();
          continue;
        } 
        String[] arrayOfString = paramString.split(",");
        if (arrayOfString.length < 2) {
          paramString = bufferedReader.readLine();
          continue;
        } 
        boolean bool = paramString.contains("#genre#");
        byte b = 0;
        if (bool) {
          str2 = arrayOfString[0].trim();
          if (!paramLinkedHashMap.containsKey(str2)) {
            LinkedHashMap<Object, Object> linkedHashMap = new LinkedHashMap<Object, Object>();
            this();
            paramLinkedHashMap.put(str2, linkedHashMap);
          } else {
            LinkedHashMap linkedHashMap = paramLinkedHashMap.get(str2);
          } 
        } else {
          String str = arrayOfString[0].trim();
          arrayOfString = arrayOfString[1].trim().split("#");
          while (true) {
            paramString = str2;
            if (b < arrayOfString.length) {
              String str4 = arrayOfString[b].trim();
              if (!str4.isEmpty() && (str4.startsWith("http") || str4.startsWith("rtsp") || str4.startsWith("rtmp"))) {
                if (!str2.containsKey(str)) {
                  arrayList1 = new ArrayList();
                  this();
                  str2.put(str, arrayList1);
                } else {
                  arrayList1 = (ArrayList)str2.get(str);
                } 
                if (!arrayList1.contains(str4))
                  arrayList1.add(str4); 
              } 
              b++;
              continue;
            } 
            break;
          } 
        } 
        String str3 = bufferedReader.readLine();
        ArrayList<String> arrayList2 = arrayList1;
        String str1 = str3;
      } 
      bufferedReader.close();
      if (!linkedHashMap2.isEmpty())
        paramLinkedHashMap.put("未分组", linkedHashMap2); 
    } finally {}
  }
  
  public static void q(LinkedHashMap<String, LinkedHashMap<String, ArrayList<String>>> paramLinkedHashMap, String paramString, HashMap<String, String> paramHashMap) {
    j(paramLinkedHashMap, fP.oq(paramString, paramHashMap));
  }
}


/* Location:              /Users/hetaiyi/Desktop/my/tech/java/study/aa/temp/temp.jar!/com/github/catvod/spider/merge/oe.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */